import numpy as np
from keras import Input
from keras.applications import MobileNetV2, ResNet50V2, DenseNet121, InceptionResNetV2
# from datamanager import data_manager
#
#
# def n4ton(data):
#     res = []
#     for col in data:
#         for i in range(len(col)):
#             if col[i] == 1:
#                 res.append(i)
#                 break
#     return np.array(res)
#
# aaa = data_manager.y_test
# input()
#
from keras.utils import plot_model

from config import ModelLayers
from configuration.model_congig import ModelConfig
from log import log
from model import Model

resnet50v2 = [
[ModelLayers.ConvBase, ResNet50V2, False, 0, "avg"],

]
if __name__=="__main__":
    # model_type = ResNet50V2
    # model_type = MobileNetV2
    # model_type = DenseNet121
    # model_type = InceptionResNetV2
    # ConvBase = model_type(
    #     include_top=True,
    # )
    # ConvBase.summary()
    # plot_model(ConvBase,
    #            show_shapes=True,
    #            to_file=model_type.__name__+".png",
    #            show_layer_names=True,
    #            show_layer_activations=True)
    # ConvBase = model_type(
    #     include_top=False,
    #     pooling="avg"
    # )
    # ConvBase.summary()
    # plot_model(ConvBase,
    #            show_shapes=True,
    #            to_file=model_type.__name__+"no-head"+".png",
    #            show_layer_names=True,
    #            show_layer_activations=True)
    conf = ModelConfig()
    inputs = Input(shape=(conf.IMAGE_HEIGHT, conf.IMAGE_HEIGHT, conf.COLOR_CHANNELS))
    m1 = Model(conf, inputs)

    m1.create_by_list_real_cls_functional(resnet50v2, None, True)
    m1.model.summary(show_trainable=True)
    # m1.model.summary(show_trainable=True, expand_nested=True)

    m1.compile()